Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Feb 26, 2025

@llvm/pr-subscribers-debuginfo

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/128826.diff

1 Files Affected:

  • (modified) llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp (+3-4)
diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
index 67aa71027687a..97214948d014a 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
@@ -268,10 +268,9 @@ class LVStringRecords {
 
   void add(TypeIndex TI, StringRef String) {
     static uint32_t Index = 0;
-    if (Strings.find(TI) == Strings.end())
-      Strings.emplace(
-          std::piecewise_construct, std::forward_as_tuple(TI),
-          std::forward_as_tuple(++Index, std::string(String), nullptr));
+    auto [It, Inserted] = Strings.try_emplace(TI);
+    if (Inserted)
+      It->second = std::make_tuple(++Index, std::string(String), nullptr);
   }
 
   StringRef find(TypeIndex TI) {

@kazutakahirata kazutakahirata merged commit e49c8d5 into llvm:main Feb 26, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_llvm_DebugInfo branch February 26, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants